import { useSelector } from "react-redux";
import { StateType } from "../store";
import { ComponentStateType } from "../store/componentsReducer";
const useGetComponentInfo = () => {
  const components = useSelector<StateType>(
    (state) => state.components.present
  ) as ComponentStateType;
  const { componentList = [], selectId, copiedComponent } = components;
  const selectedComponent = componentList.find((c) => c.fe_id === selectId);
  return {
    componentList,
    selectId,
    selectedComponent,
    copiedComponent,
  };
};
export default useGetComponentInfo;
